/*
 * Copyright 2012 Finbudget.com
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * 
 * http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package finbudgettable.client.ui.grid.style;

import com.google.gwt.core.client.JavaScriptObject;

public class StyleSheet extends JavaScriptObject {

    protected StyleSheet() {
    }

    public final native Rules getRules()/*-{
        if (this.cssRules) {                    // Browser uses cssRules?
            return this.cssRules;         // Yes --Mozilla Style
        } else {                                      // Browser usses rules?
            return this.rules;            // Yes IE style.
        }
    }-*/;

    public final native void removeRule(int index)/*-{
        if (this.deleteRule) {
            this.deleteRule(index);
        } else {
            this.removeRule(index);
        }
    }-*/;

    public final native void addRule(String name)/*-{
        if (this.addRule) {                        // Browser is IE?
            this.addRule(name, null, 0);           // Yes, addRule IE style
        } else {                                   // Browser is IE?
            this.insertRule(name + ' { }', 0);     // Yes, addRule Moz style.
        }
    }-*/;
}
